package weaver.aiyh_pcn.workflow_to_customer.utils;

import com.ibm.icu.text.SimpleDateFormat;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author EBU7-dev1-ayh
 * @create 2021/8/10 0010 10:42
 * mybatisTest.dao class
 */


public class Utils {
	public static String getTime(String format) {
		Date date = new Date();
		SimpleDateFormat formatter = new SimpleDateFormat(format);
		return formatter.format(date);
	}

	public static boolean conformSql(Map<String, List<Map<String, Object>>> configInfoMap,String key){
		return configInfoMap.containsKey(key) && !Objects.isNull(configInfoMap.get(key));
	}

	public static UtilMap<String, Object> createMap(){
		return new UtilMap<>();
	}

	public static String removeSeparator(StringBuilder sqlBuilder){
		String str = sqlBuilder.toString().trim();
		String removeSeparator = ",";
		if(str.endsWith(removeSeparator)){
//			如果以分割号结尾，则去除分割号
			str = str.substring(0,str.length() - 1);
		}
		if(str.trim().startsWith(removeSeparator)){
			str = str.substring(1);
		}
		return  str;
	}
}
